<template>
	<view class="mainpadding2">
		<view class="flexcenter" v-if="!list.data.length">
			<view class="placeholderimage" style="margin-top: 300rpx;" ></view>
		</view>
		<view class="flexleft flex_wrap">
			<view class="sanshis flexcenter margin_top" v-for="item in list.data" :key="item.id" @click="tzjlxq(item.jl_user_zbfapply_id)">
				<view class="">
					<view class="jiaolt">
						<image :src="item.zbfapply.logo_text" mode=""></image>
					</view>
					<view class="xiaohei titletext nofonweight margin_top2 textcenter">{{item.zbfapply.name}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				listid: "",
				page: 1,
				limit: 30,
				list: {
					data: []
				},
			}
		},
		onLoad(options) {
			this.listid = options.id
			this.init()
		},
		methods: {
			init(isPage, page) {
				let _this = this;
				let data = {
					page: page || 1,
					limit: _this.limit,
					user_zbfapply_id: this.listid
				}
				let url = '/api/user/cgJlList'
				httpRequest.request(url, 'GET', data, false, false, true).then(res => {
					if (res.code == 1) {
						let resList = res.data;
						let dataList = _this.list;
						if (isPage == true) {
							_this.list.data = dataList.data.concat(resList.data);
						} else {
							this.list = res.data
							_this.list.data = resList.data;
						}
						this.$forceUpdate()
					}
				})
			},
			onReachBottom() {
				let _this = this;
				let list = _this.list;
				let page = _this.page;
				if (list.last_page <= page) {
					return false;
				}
				page++;
				_this.page = page;
				_this.init(true, page);
			},
			// 跳转教练详情
			tzjlxq(id) {
				uni.navigateTo({
					url: '/pages_homepage/jiaolianxq?id='+id
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.jiaolt {
		width: 210rpx;
		height: 210rpx;

		image {
			width: 100%;
			height: 100%;
		}
	}

	page {
		background: #F9F9F9;
	}
</style>